package com.molichuxing.job;

import com.molichuxing.service.StatisticsService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author: zhaopenghui
 * @Description: 资产统计
 * @Date: Created in 16:59 2020/08/24
 * @Modified By:
 **/
@JobHandler(value = "statisticsAssetHandler")
@Component
public class StatisticsAssetHandler extends IJobHandler {

    private static final Logger log = Logger.getLogger(StatisticsAssetHandler.class);


    @Resource
    private StatisticsService statisticsService;

    public StatisticsAssetHandler() {
        super();
    }

    @Override
    public void init() {
        super.init();
    }

    @Override
    public void destroy() {
        super.destroy();
    }

    @Override
    public ReturnT<String> execute(String s) throws Exception {
        ReturnT<String> returnT = ReturnT.SUCCESS;
        log.info("==============================资产统计 开始定时任务");
        Boolean result = statisticsService.getAsset();
        log.info("==============================资产统计 结束定时任务");
        returnT.setContent("资产统计 定时任务的任务结果result：" + result);
        return returnT;
    }


}
